"""LangChainTools"""

import os

from langchain.agents import load_tools
from langchain.agents import initialize_agent
from langchain.agents import AgentType
from langchain.llms import Tongyi

from langchain.tools import DuckDuckGoSearchRun

# duck duck search
search = DuckDuckGoSearchRun()

res = search.run("北京的面积有多大？")
print(res)

res = search.run("纽约的面积有多大？")
print(res)


os.environ["DASHSCOPE_API_KEY"] = "sk-965dc39b016c49ecbe29de180f4db2b6"

llm = Tongyi()

tools = load_tools(["ddg-search", "llm-math"], llm=llm)

agent = initialize_agent(
    tools,
    llm,
    agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
    verbose=True)

agent.run("北京的面积和纽约的面积差是多少？")